<?php

namespace soa\express\express;
use soa\client;

class filter extends client
{
 
    private static $code,$index = [];

    public static function inFilterByCode($code , $brand = 'sto')
    {
        if(empty(self::$code))
        {
            $func = 'filterCodeBy'.ucfirst($brand);
            self::$code = self::$func();
        }

        if(in_array($code,self::$code))
            return true;
        return false;
    }

    public static function inFilterByIndex($index_shop_id = 0 , $brand = 'sto')
    {
        if(empty(self::$index))
        {
            $func = 'filterCodeBy'.ucfirst($brand);
            $arr  = \artisan\db::connect('kd_shop')->table('tbl_branch_list')->select('MainId as index_shop_id')->getAll(['BranchCode IN'=>self::$func()]);
            self::$index = array_column($arr,'index_shop_id');
        }

        if(in_array($index_shop_id,self::$index))
            return true;
        return false;
    }

    private static function filterCodeBySto()
    {
        return[
            "361001","450003","210002","214001","214501","100001","215001","224210","250001","321001","333555","710001","264001","315002","314501","213002","310001","330080","410001","430001","223300","221408","226001","226601","224201","510002","322001","310002","330001","315118","325111","SHST020","200082","SHST022","516002","250002","266001","241001","350001","200054","210011","330002","214003","333333","225410","200019","900001","000002","540001","116002","830002","650222","150666","135222","800222","250222","310222","510223","250003","510003","518004","410002","430005","110020","110021","150018","261001","350666","518118","740002","110022","528001","528002","201102","518005","130015","200052","200053","200055","200057","200058","119000","510111","SHST019","529602","276001","301100","201100","150003","100222","350002","361002","730002","510222","570002","300004","511710","300003","630002","550002","450005","710002","130003","530002","900002","502222","735002","288888","322002","550003","230002","610509","230003","529601","541001","450222","101222","810002","261002","362001","264002","200056","325002","266302","510171","315011","150004","610222","273101","210111","221001","202000","130002","333222","233001","541002","200051","276002","265202","150005","221002","510172","848001","434001","712002","163002","300006","471002","832002","572002","133002","341001","341002","150019","844001","830003","650010","434002","441002","845351","630050","541003","235018","300100","116003","570003","365501","365502","900091","518003","471001","299999","266011","441001","610003","273102","830001","130014","137002","124001","124002","637001","637002","265204","301711","214401","223003","324001","157001","118001","166001","200050","621001","665001","164301","137401","215002","017000","643002","536001","643001","835001","265203","841001","362202","302222","462001","462002","421201","421202","272103","235003","146001","719001","128001","427001","836501","161001","843001","666101","154002","116005","615001","839001","834001","674101","677004","833402","233002","511735","533001","518066","110029","026002","724002","736202","200023","000033","363002","225003","200028","363001","540013","537002","330081","336501","336502","154003","225402","226002","540017","224203","200090","213004","516010","241002","453053","201312","435001","453052","450052","450053","211401","314001","435002","236001","430149","430151","430152","161005","511784","816001","518088","537003","518030","110080","200031","430150","430154","000050","236002","200032","351102","352118","000052","000053","476001","518049","518050","352119","476002","617019","457002","654301","641401","053000","071001","657001","617014","154100","671021","061001","330047","255026","256600","453022","050000","253001","062550","655002","157003","021402","343003","661400","344001","000102","274300","000107","514002","333001","000109","224100","266201","666103","056001","455000","110078","524005","150108","663001","472001","556001","675008","264206","511403","000123","200940","201611","351104","333000","665004","679103","678601","354301","518099","415002","246002","017001","854001","850024","264201","621002","525100","526100","528430","519020","528310","735001","430155","900003","671003","362022","315022","021000","130522","725001","725002","404100","404101","671002","044000","362021","201607","276003","021401","404102","151001","671001","226300","724003","201703","200115","213018","201502","200083","324002","222304","201606","200116","201801","200177","200120","712003","415001","246001","445001","800073","201706","800012","800013","800002","800009","800069","800066","800067","436001","012601","800014","800070","800071","800063","800074","800047","362023","800075","800003","800062","800064","800008","800065","800072","800080","800068","226011","436000","265201","838002"];
    }
}